package com.youku
{
   import com.youku.interfaces.IExPluginProxy;
   import com.youku.interfaces.IPlayerProxy;
   import flash.display.MovieClip;
   import flash.display.DisplayObject;
   import com.youku.interfaces.ICore;
   import com.youku.events.PluginEvent;
   
   public class ExPluginProxy extends Object implements IExPluginProxy
   {
      
      public function ExPluginProxy() {
         super();
         this.init();
      }
      
      public function get playerProxy() : IPlayerProxy {
         return GlobalService.getService(GlobalServiceKeys.PLAYER_PROXY) as IPlayerProxy;
      }
      
      public function get viewManager() : ViewManager {
         return GlobalService.getService(GlobalServiceKeys.VIEW_MANAGER) as ViewManager;
      }
      
      private function init() : void {
      }
      
      public function get videoHeight() : Number {
         return this.playerProxy.playerData.videoCurrentHeight;
      }
      
      public function get videoWidth() : Number {
         return this.playerProxy.playerData.videoCurrentWidth;
      }
      
      public function get videoRealHeight() : Number {
         return this.playerProxy.playerData.videoCurrentRealHeight;
      }
      
      public function get videoRealWidth() : Number {
         return this.playerProxy.playerData.videoCurrentRealWidth;
      }
      
      public function get videoLayer() : MovieClip {
         return this.viewManager.videoLayer;
      }
      
      private function get controlLayer() : MovieClip {
         return this.viewManager.controlsLayer;
      }
      
      public function get video() : DisplayObject {
         if(!this.core)
         {
            return null;
         }
         return this.core.video;
      }
      
      protected function get core() : ICore {
         return GlobalService.getService(GlobalServiceKeys.CORE) as ICore;
      }
      
      public function externalRender() : void {
         this.playerProxy.dispatchEvent(new PluginEvent(PluginEvent.EX_THREED_RENDER,{"stop":false}));
      }
   }
}
